package com.funwell.modules.controller;


import com.funwell.modules.controller.request.page.PageRequestBean;
import com.funwell.modules.controller.request.systask.SysTaskRequestBean;
import com.funwell.modules.service.systask.SysTaskService;
import com.funwell.server.annotation.ACS;
import com.funwell.server.utils.ResponseEntity;
import com.funwell.server.utils.ResponseEntityUtil;
import com.funwell.server.base.BaseController;
import com.funwell.server.task.HScheduleTrigger;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * @author sunfangwei
 *
 */
@Api(value="任务调度功能",description="任务调度功能",produces = "application/json")
@RestController
@RequestMapping(value="systask")
public class SysTaskController extends BaseController {

    @Autowired
    private SysTaskService sysTaskService;

    @ACS(allowAnonymous = true)
    @ApiOperation(value = "新增任务", notes = "新增任务")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public  ResponseEntity add(@RequestBody SysTaskRequestBean task){
        sysTaskService.add(task);
        return ResponseEntityUtil.success();
    }

    @ACS(allowAnonymous = true)
    @ApiOperation(value = "删除任务", notes = "删除任务")
    @RequestMapping(value = "/detele", method = RequestMethod.POST)
    public  ResponseEntity detele(@RequestBody SysTaskRequestBean task){
        sysTaskService.detele(task);
        return ResponseEntityUtil.success();
    }

    @ACS(allowAnonymous = true)
    @ApiOperation(value = "更新任务", notes = "更新任务")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public  ResponseEntity update(@RequestBody  SysTaskRequestBean task){
        sysTaskService.update(task);
        return ResponseEntityUtil.success();
    }


}
